﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes.sim {
    import Classes.*;
    import Engine.*;

    public class POI {

        private var m_mapResource:MapResource;
        private var m_attraction:int;
        private var m_probability:Number;
        private var m_influenceRadius:int;
        private var m_maxNPCs:int;
        private var m_maxLoiterActions:int;
        private var m_actions:Array;

        public function POI(_arg1:MapResource, _arg2:int, _arg3:int, _arg4:int, _arg5:int){
            this.m_mapResource = _arg1;
            this.m_attraction = _arg2;
            this.m_influenceRadius = _arg3;
            this.m_maxNPCs = _arg4;
            this.m_maxLoiterActions = _arg5;
        }
        public function addAction(_arg1:String):void{
            if (this.m_actions == null){
                this.m_actions = new Array();
            };
            this.m_actions.push(_arg1);
        }
        public function get attraction():int{
            return (this.m_attraction);
        }
        public function get influenceRadius():int{
            return (this.m_influenceRadius);
        }
        public function get maxNPCs():int{
            return (this.m_maxNPCs);
        }
        public function get probability():Number{
            return (this.m_probability);
        }
        public function setProbability(_arg1:Number):void{
            if (_arg1 > 0){
                this.m_probability = ((this.m_attraction / _arg1) as Number);
            } else {
                this.m_probability = 0;
            };
        }
        public function get action():String{
            return (MathUtil.randomElement(this.m_actions));
        }
        public function get resource():MapResource{
            return (this.m_mapResource);
        }
        public function get maxLoiterActions():int{
            return (this.m_maxLoiterActions);
        }
        public function calculateAttraction(_arg1:Number):void{
            var _local2:Number = (_arg1 / this.m_influenceRadius);
            this.m_attraction = (this.m_attraction * (1 - _local2));
        }
        public function clone():POI{
            var _local1:POI = new POI(this.m_mapResource, this.m_attraction, this.m_influenceRadius, this.m_maxNPCs, this.m_maxLoiterActions);
            var _local2:int;
            while (_local2 < this.m_actions.length) {
                _local1.addAction(this.m_actions[_local2]);
                _local2++;
            };
            return (_local1);
        }

    }
}//package Classes.sim 
